package com.beadwallet.alarm.util;

import java.io.InputStream;
import java.util.Properties;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class PropertiesUtil {

  
    private static Logger logger = LoggerFactory.getLogger(PropertiesUtil.class);
	private static Properties properties;
	public static ExecutorService  executorService = null;
	static{
		properties = new Properties();
		try {
		    InputStream ins = PropertiesUtil.class.getClassLoader().getResourceAsStream("config.properties");
		    executorService = new ThreadPoolExecutor(20, 100,5L ,TimeUnit.MINUTES, new LinkedBlockingQueue<Runnable>(200));
			properties.load(ins);
			ins.close();
		} catch (Exception e) {
		  logger.error("", e);
		}
	}
	
	public static Properties getProperties() {
		return properties;
	}
	
	public static Integer getIntegerValue(String key){
		return Integer.parseInt(properties.getProperty(key));
	}
	
	public static String getStringValue(String key){
		return (String)properties.getProperty(key);
	}
	
	public static boolean getBooleanValue(String key){
		return Boolean.parseBoolean(properties.getProperty(key));
	}
	
	public static Object getValue(String key){
		return properties.getProperty(key);
	}
	
	

}
